import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/account_exchange_entity.dart';

AccountExchangeEntity $AccountExchangeEntityFromJson(
    Map<String, dynamic> json) {
  final AccountExchangeEntity accountExchangeEntity = AccountExchangeEntity();
  final double? id = jsonConvert.convert<double>(json['id']);
  if (id != null) {
    accountExchangeEntity.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    accountExchangeEntity.name = name;
  }
  final double? recommend = jsonConvert.convert<double>(json['recommend']);
  if (recommend != null) {
    accountExchangeEntity.recommend = recommend;
  }
  final String? txtZh = jsonConvert.convert<String>(json['txt_zh']);
  if (txtZh != null) {
    accountExchangeEntity.txtZh = txtZh;
  }
  final String? txtEn = jsonConvert.convert<String>(json['txt_en']);
  if (txtEn != null) {
    accountExchangeEntity.txtEn = txtEn;
  }
  final String? txtTha = jsonConvert.convert<String>(json['txt_tha']);
  if (txtTha != null) {
    accountExchangeEntity.txtTha = txtTha;
  }
  final String? address = jsonConvert.convert<String>(json['address']);
  if (address != null) {
    accountExchangeEntity.address = address;
  }
  final String? icon = jsonConvert.convert<String>(json['icon']);
  if (icon != null) {
    accountExchangeEntity.icon = icon;
  }
  return accountExchangeEntity;
}

Map<String, dynamic> $AccountExchangeEntityToJson(
    AccountExchangeEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['recommend'] = entity.recommend;
  data['txt_zh'] = entity.txtZh;
  data['txt_en'] = entity.txtEn;
  data['txt_tha'] = entity.txtTha;
  data['address'] = entity.address;
  data['icon'] = entity.icon;
  return data;
}

extension AccountExchangeEntityExt on AccountExchangeEntity {
  AccountExchangeEntity copyWith({
    double? id,
    String? name,
    double? recommend,
    String? txtZh,
    String? txtEn,
    String? txtTha,
    String? address,
    String? icon,
  }) {
    return AccountExchangeEntity()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..recommend = recommend ?? this.recommend
      ..txtZh = txtZh ?? this.txtZh
      ..txtEn = txtEn ?? this.txtEn
      ..txtTha = txtTha ?? this.txtTha
      ..address = address ?? this.address
      ..icon = icon ?? this.icon;
  }
}